#include <stdio.h>
#include <string.h>
int f_find_location(char str[], char c, int t) {
    char *ptr;
    //t == 0从左到右查, t != 0, 从右到左查
    (t == 0) ? (ptr = strchr(str, c)) : (ptr = strrchr(str, c));
    if (ptr)
        return (int)(ptr - str);
    else
        return -1;
}

int f_del_char(char str[], char res[], char c) {
    int i = 0;
    memset(res, 0x00,sizeof(res));
    for(i = 0; i < strlen(str); i++) {
        if(str[i] != c)
            sprintf(res,"%s%c", res, str[i]);
    }
    return 0;
}

